package bj.actor

import scala.actors.Actor
import scala.actors.OutputChannel
import bj.card.Card



class RemotePlayer(val serviceName: Symbol, val remoteAddress: String, remotePort: Int, 
				   remoteName: String, remoteBankRoll: Double, remoteBet: Double) extends 
				   Player(remoteName, remoteBankRoll, remoteBet) 
{
  def rName = remoteName
  def rBank = remoteBankRoll
  def rBet  = remoteBet
  
/*
  def analyze(upcard: Card): Request = {
    receive {
     case HitRequest(remotePid: Int) => println("Hello!"); return Hit(pid) 
    }
  }

*/
  /** Analyzes my best play using a condensed form of Basic Strategy. */
  def analyze(upcard: Card): Request = {
    // If my hand >= 17, we're staying
    if (value >= 17)
      return Stay(pid)

    // If I have ten or less, no harm in hitting
    if (value <= 10)
      return Hit(pid)

    // If the dealer can bust, we're staying
    if (upcard.value >= 2 && upcard.value <= 6)
      return Stay(pid)

    // Dealer must be showing, A, 7, 8, 9, or 10 so...
    // we must hit
    return Hit(pid)
  }
}